#include<iostream>
#define ll long long

using namespace std;


int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,m;
		cin>>n>>m;
		ll ans = (m-1) * n + m * (n-1);
		if(ans > m * n) puts("NO");
		else puts("YES");
	}
	return 0;
 } 
